function ts_main1(nums: number[]): number {
  const len = nums.length;
  if (len < 2) return len;
  let count = 0;
  for (let i = 1; i < len; i++) {
    if (nums[count] !== nums[i]) {
      // 优化?处理器在处理相同数据赋值时是否会直接跳过不执行?
      // if (i > count) {
      //   nums[count + 1] = nums[i];
      // }
      nums[count + 1] = nums[i];
      count += 1;
    }
  }
  return count + 1;
}

const test11 = [1, 1, 2];
const len11 = ts_main1(test11);
test11.length = len11;
console.log(len11, test11);

const test22 = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4];
const len22 = ts_main1(test22);
test22.length = len22;
console.log(len22, test22);
